Disable watch callbacks while running the driver probe callback.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Wed, 12 Oct 2005 17:43:26 +0000 (18:43 +0100)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Wed, 12 Oct 2005 17:43:26 +0000 (18:43 +0100)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c

index 09d0d8db954af7e3420c3a8fa12872670d3aa40c..4471f10d3284ebb957bec0043e7eeb66bf16aab6 100644 (file)
@@ -39,6 +39,8 @@
 #include <linux/notifier.h>
 #include "xenbus_comms.h"
 
+extern struct semaphore xenwatch_mutex;
+
 #define streq(a, b) (strcmp((a), (b)) == 0)
 
 static struct notifier_block *xenstore_chain;
@@ -205,6 +207,7 @@ static int xenbus_dev_probe(struct device *_dev)
        struct xenbus_device *dev = to_xenbus_device(_dev);
        struct xenbus_driver *drv = to_xenbus_driver(_dev->driver);
        const struct xenbus_device_id *id;
+       int ret;
 
        if (!drv->probe)
                return -ENODEV;
@@ -213,7 +216,10 @@ static int xenbus_dev_probe(struct device *_dev)
        if (!id)
                return -ENODEV;
 
-       return drv->probe(dev, id);
+       down(&xenwatch_mutex);
+       ret = drv->probe(dev, id);
+       up(&xenwatch_mutex);
+       return ret;
 }
 
 static int xenbus_dev_remove(struct device *_dev)
index ad44cf100ad5a2f2e3d445198ccce1e7e5b40a85..efaffe2393b9cbee48f9f926258194b522293821 100644 (file)
@@ -92,7 +92,7 @@ static DEFINE_SPINLOCK(watch_events_lock);
  * carrying out work.
  */
 static pid_t xenwatch_pid;
-static DECLARE_MUTEX(xenwatch_mutex);
+/* static */ DECLARE_MUTEX(xenwatch_mutex);
 static DECLARE_WAIT_QUEUE_HEAD(watch_events_waitq);
 
 static int get_error(const char *errorstring)